home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
098
/
fft12.arc
/
GETDATA2.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1985-04-29
|
2KB
|
57 lines
program getdata;
type
data =
record
re,im :real
end;
range = array[1..256] of data;
var
a,index :integer;
xk :range;
PROCEDURE WRITEDATA(VAR D: RANGE; VAR A: INTEGER);
TYPE DATA= RECORD
W,Z : REAL
END;
VAR INDEX :INTEGER;
XY: ARRAY[1..256] OF DATA;
DATAFILE: FILE OF DATA;
FILENAME: STRING[16];
BEGIN
WRITE('Enter Name of Output File w/o Extension : '); READLN(FILENAME);
FILENAME:= FILENAME+'.DAT';
ASSIGN(DATAFILE,FILENAME);
REWRITE(DATAFILE);
FOR INDEX:=1 TO A DO
BEGIN
WITH XY[INDEX] DO
BEGIN
W:=D[INDEX].RE;
Z:=D[INDEX].IM
END;
WRITE(DATAFILE,XY[INDEX])
END;
CLOSE(DATAFILE)
END;
begin
clrscr;
gotoxy(19,1);writeln('Program to Enter Complex Pairs into a File');
writeln;writeln;
writeln('If you are planning to use this with the FFT program, the');
writeln('number of complex data points must be a power of 2!');
writeln;
write('Enter number of complex data points <=256 : ');readln(a);
gotoxy(19,12);writeln('--------------* Input Data *--------------');writeln;
for index:=1 to a do begin
write('real(',index,') ===> : ');readln(xk[index].re);
write('imag(',index,') ===> : ');readln(xk[index].im);
writeln;
end;
writedata(xk,a);
writeln;writeln;
for index:=1 to a do
writeln('real(',index,')=',xk[index].re,' imaginary(',index,')=',xk[index].im);
end.